/**
 * Created by gongxun on 17/8/15.
 */

var KwxWxShopItem = GameBaseItem.extend({
    mInfo : null,
    callBack : null,
    callObj : null,
    ctor: function (info, callObj, callBack) {
        this._super();
        this.loadCocostudio("res/ccs/KwxWxStoreItem.json");
        mo.gameHelper.fixIosText(this.ccsNode);
        this.mInfo = info;
        this.callBack = callBack;
        this.callObj = callObj;

        mo.seekWidgetByName(this.ccsNode, "Button_pay").addTouchEventListener(function (sender, type) {
            if (mo.gameHelper.getIsTouchEndMenuClose(type)) {
                if (this.callObj != null){
                    this.callBack.call(this.callObj, this.mInfo);
                }
            }
        }, this);

        if (this.mInfo != null){
            var Text_price = mo.seekWidgetByName(this.ccsNode, "Text_price");
            mo.gameHelper.setTextString(Text_price, info.money + "元人民币");

            var Text_num = mo.seekWidgetByName(this.ccsNode, "Text_num");
            mo.gameHelper.setTextString(Text_num,"x" + info.get_items_num + mo.gameHelper.getItemIdForCHS(info.get_items_id));

            //pic
            mo.gameHelper.loadImageForUrl(mo.seekWidgetByName(this.ccsNode, "Image_pic"), info.img);
        }
    }
});